require'enet'
class = require'lib.middleclass'
Stateful = require'lib.stateful'
loader = require'lib.ATL.trunk.loader'
require'lib.sha256'
require'lib.AnAL'
require'src.client'



function love.load()
	require'lib.loveframes'	
	--loader.path = "assets/maps/"

	love.keyboard.setKeyRepeat(false)

	client = Client:new("localhost", "1337")
	print("love loaded")
end

function love.update(dt)
	dt = math.min(0.01666667, dt)
	client:update(dt)

	loveframes.update(dt)
end

function love.draw()
	client:draw()

	loveframes.draw()
end

function love.keypressed(key, isRepeat)

	if key == "b" then debug.debug() end

	client:keypressed(key, isRepeat)

	loveframes.keypressed(key, isRepeat)
end

function love.keyreleased(key)
	client:keyreleased(key)

	loveframes.keyreleased(key)
end

function love.mousepressed(x, y, button)
	client:mousepressed(x, y, button)

	loveframes.mousepressed(x, y, button)
end

function love.mousereleased(x, y, button)
	client:mousereleased(x, y, button)

	loveframes.mousereleased(x, y, button)
end

function love.textinput(text)
	client:textinput(text)

	loveframes.textinput(text)
end

function love.threaderror(thread, errorstr)
	print("Thread Error!\n".. errorstr)
end

function love.quit()
	client:quit()
end